<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" src="js/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
function hidd(){
	var span=document.getElementById("sname");
	span.style.display="none";
}
function show(){
	var span=document.getElementById("sname");
	span.style.display="block";
}
function reg(){
	var pas=document.f.password.value;
	var pas2=document.f.password2.value;
	if(pas==""){
		alert("请输入密码");
	}else if(pas!=pas2){
		document.f.password.value="";
		document.f.password2.value="";
		alert("您两次输入的密码不一致");
	}else{
		document.f.submit();
	}
}
</script>
</head>
<body>
<form action="RegisterServlet" name="f">
用户名：<input type="text" name="username"><br>
密码：<input type="password" name="password"><br>
确认密码：<input type="password" name="password2"><br>
昵称：<input type="text" name="nickname"><br>
手机号：<input type="text" name="phone"><br>
真实姓名：<input type="text" name="truename"><br>
身份证号：<input type="text" name="idnumber"><br>
角色：<input name="role" type="radio" value="2" checked onclick="hidd();">普通用户
<input name="role" type="radio" value="3" onclick="show();">商家用户<br>
<span id="sname" style="display:none">店铺名称：<input type="text" name="shopname"><br></span>
<input type="submit" value="注册" onclick="reg();">
</form>
</body>
</html>